#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2010 - BidiX@BidiX.info
#
#
'''
    unittest - test package
'''
import unittest
from bidix.db import Article


class ArticleTestCase(unittest.TestCase):
 
 
    def runTest(self):
        #article.delete_all()
#        a = Article(name='test', title="titre", text="texte", tags=['t1', 't2'])
#        a.put()
#        b = Article.get_by_name('test')
#        self.assert_(b, "Article 'test' not found")
#        s = b.format_to_html()
#        self.assert_(s, "b.format_to_html() empty")
#        s = b.format_to_txt()
#        self.assert_(s, "b.format_to_txt() empty")
#        s = b.format_to_xml()
#        self.assert_(s, "b.format_to_xml() empty")
#        b.delete()
#        b = Article.get_by_name('test')
#        self.assert_(not b, "Article 'test' not deleted")
        a = Article.add_or_replace('toto', name ='toto', title="Titre", text="Ceci est un texte", tags=['t3', 't4'])
        self.assert_(a, "get_or_insert error.")
        return "Article tests ok"
        
